﻿@page "/counter"
@using WinformBlazor.Components

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p  role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me1111</button>
<WinformBlazor.Components.Control Data="Value">

</WinformBlazor.Components.Control>
@code {
    private int currentCount = 0;
    public ControlInfo Value { get; set; } = new();

    protected override async Task OnInitializedAsync()
    {
        await base.OnInitializedAsync();
        Value.Type = ContrloType.Form;
        Value.Style.background_color = "red";
        Value.Childs.Add(
            new ControlInfo()
                {
                    Name = "btn",

                    Type = ContrloType.Button
                }
        );
        Value.Childs.Add(
           new ControlInfo()
               {
                   Name = "容器",



                   Type = ContrloType.Panel,
                   Childs = new List<ControlInfo>()
                                   {
                   new ControlInfo()
                   {
                   Name="input",Type= ContrloType.Textbox
                   }   ,
                     new ControlInfo()
                   {
                   Name="input2",Type= ContrloType.Textbox
                   }
                                   }

               }
       );
        Value.Childs.Add(
         new ControlInfo()
             {
                 Name = "btn",

                 Type = ContrloType.CheckBox
             }
     );
    }
    private void IncrementCount()
    {
        currentCount++;
    }
}
